home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10620 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Can a structure element be static?
  5. Date: Mon, 18 Mar 96 22:23:45 GMT
  6. Organization: none
  7. Message-ID: <827187825snz@genesis.demon.co.uk>
  8. References: <4iiqgm$3n3@gryphon.phoenix.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4iiqgm$3n3@gryphon.phoenix.net>
  15.            brucew@phoenix.net "Bruce Wedding" writes:
  16.  
  17. >I was recently asked if a struct element can be static.  I
  18. >replied of course not, since all elements of a struct have to be
  19. >contiguous, the entire struct has to be static.  I then searched
  20. >the standard.  I can't really pin down a spot that would disallow
  21. >this other than the inference one can draw from the statement
  22. >that all addresses must be in order. 
  23.  
  24. It is simply a syntax error. If you look at the production rules in
  25. 6.5.2.1 you will see there is nothing there that allows a
  26. storage-class-specifier (6.5.1) to appear in a member declaration
  27. (struct-declaration).
  28.  
  29. >In any event, I don't own a compiler that will accept a static
  30. >element, and I've tried it on 5 compilers.  The poser claims that
  31. >such a struct will compile on TC 1.0 for dos and BC 4.5 for dos.
  32.  
  33. Since it is a syntax error it requires a diganostic from any
  34. conforming compiler. As always the compiler can still proceeed to generate
  35. an executable if it wishes.
  36.  
  37. -- 
  38. -----------------------------------------
  39. Lawrence Kirby | fred@genesis.demon.co.uk
  40. Wilts, England | 70734.126@compuserve.com
  41. -----------------------------------------
  42.